package com.yzt.message.util;

import android.text.TextUtils;

import com.yzt.message.custom.RXGiftMessageContent;
import com.yzt.message.MessageConstants;
import com.yzt.message.custom.BroadcastMessageContent;
import com.yzt.message.custom.RXCustomTipMessageContent;
import com.yzt.message.custom.RXShowTipMessageContent;
import com.yzt.message.custom.RxAgoraCallMessageContent;

import io.rong.imlib.model.MessageContent;

/**
 * author : Irene
 * e-mail : 979858658@qq.com
 * date   : 2020/1/16 16:14
 * desc   :
 */
public class MessageInfoUtil {

    public static boolean isSystemNotice(String senderUserId) {
        if (TextUtils.isEmpty(senderUserId)) {
            return false;
        }
        switch (senderUserId) {
            case MessageConstants.TYPE_INTERACTIVE_MESSAGE:
            case MessageConstants.TYPE_ACCOUNT_SYSTEM:
            case MessageConstants.TYPE_ACCOUNT_PAY:
            case MessageConstants.TYPE_PUSH_NOTICE:
                return true;
        }
        return false;
    }

    public static boolean isSpecialUser(String senderUserId) {
        return senderUserId.equals(MessageConstants.TYPE_ACCOUNT_BACKGROUND);
    }

    /**
     * 过滤消息发送者
     */
    public static boolean isNeedFilter(String senderUserId) {
        return isSystemNotice(senderUserId) || isSpecialUser(senderUserId);
    }

    public static boolean isNeedFilterMessageContent(MessageContent messageContent) {
        return messageContent instanceof RXCustomTipMessageContent ||
                messageContent instanceof BroadcastMessageContent ||
                messageContent instanceof RXShowTipMessageContent ||
                messageContent instanceof RxAgoraCallMessageContent ||
                messageContent instanceof RXGiftMessageContent;
    }
}
